﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Xoohoo.Extensions;
using Xoohoo.Models;
using Xoohoo.Models.ViewModels;
using Xoohoo.Infrastructure;

namespace Xoohoo.Modules.CMS.Controllers
{
    public partial class CMSController:Controller
    {
        private readonly XoohooContext _context;
        public CMSController(XoohooContext context)
        {
            _context = context;
        }

        public XoohooViewModelItem<ModuleSubMenuItemList> SubMenu()
        {
            var sm = new ModuleSubMenuItemList("内容管理") { 
                new ModuleSubMenuItemSingle{ Title="文章管理", MenuLevel=1}
                ,new ModuleSubMenuItemSingle{ Title="文章列表", ContentRouteName="Admin.CMS.Article.List", MenuLevel=2}
                ,new ModuleSubMenuItemSingle{ Title="文章添加", ContentRouteName="Admin.CMS.Article.Add", MenuLevel=2},
                new ModuleSubMenuItemSingle{ Title="栏目管理", MenuLevel=1}
                ,new ModuleSubMenuItemSingle{ Title="栏目列表", ContentRouteName="Admin.CMS.Category.List", MenuLevel=2}
                ,new ModuleSubMenuItemSingle{ Title="栏目添加", ContentRouteName="Admin.CMS.Category.Add", MenuLevel=2}
            };
            sm.RemoveByPermission(_context.User);
            return new XoohooViewModelItem<ModuleSubMenuItemList>(sm);
        }

    }
}
